from django.contrib import admin
from app01.models import Cover
from django.utils.safestring import mark_safe


# Register your models here.
class CoverAdmin(admin.ModelAdmin):

    def get_cover_url(self):
        return mark_safe(
            f"""<img src="{self.url.url}" style="height:60px;border-radius:5px; box-shadow:0 0 5px rgba(0, 0, 0, 0.1);">""")

    get_cover_url.short_description = '封面'
    list_display = ['nid', get_cover_url, 'state', 'create_date']


admin.site.register(Cover, CoverAdmin)
